package com.cooper.controllers.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.cooper.controllers.Controller;
import com.cooper.controllers.Template;
import com.cooper.pagination.PageInfo;
import com.cooper.service.item.ItemInfoService;
import com.cooper.vo.DisplayItemInfoVo;

import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.annotation.rest.Post;
import net.paoding.rose.web.portal.Portal;

public class TopSaleItemListController extends Controller {

	@Autowired
	ItemInfoService itemInfoService;
	@Template(title="热门商品选择")
	@Get @Post
	public String content(Invocation inv, Portal portal, PageInfo pageInfo) throws Exception{
		pageInfo.setPageSize(20);
		pageInfo.setRowCount(itemInfoService.queryTopSoldOutItemsCount());
		List<DisplayItemInfoVo> ret = itemInfoService.queryTopSoldOutItems(pageInfo);
		inv.addModel("entryList", ret);
		return "TopSaleItemList";
	}
}
